package mysql

import "gorm.io/gorm"

type Goods struct {
	gorm.Model
	UserId      int64   `gorm:"type:int(11);not null;用户ID"`
	GoodsTitle  string  `gorm:"type:varchar(30);not null;comment:商品名称"`
	Price       float64 `gorm:"type:decimal(10,2);not null;comment:商品价格"`
	GoodsNumber int64   `gorm:"type:int(10);not null;comment:商数量"`
	GoodsStock  int64   `gorm:"type:int(10);not null;comment:商品库存"`
	Status      int     `gorm:"type:tinyint(1);comment:状态:1正常2取消"`
	GoodsCover  string  `gorm:"type:varchar(50);not null;comment:封面"`
	GoodsStyle  string  `gorm:"type:varchar(45);not null;comment:款式"`
}

func (g *Goods) GoodsInfo(goodsId int) error {
	return Db.Where("id = ?", goodsId).Limit(1).Find(&g).Error
}
